﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Site : System.Web.UI.MasterPage
{

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            hlkFooterTest.Text = FootText();
            if (Request.Cookies["loginCookie"] != null)
            {
                lblLogOnName.Text = Request.Cookies["loginCookie"].Values["LoginName"]+": ";
            }
            else
            {
                btnLogOut.Visible = false;
            }
            string path = HttpContext.Current.Request.Url.AbsoluteUri.ToLower();
            if (path.Substring(path.LastIndexOf('/') + 1).Equals("default.aspx"))
            {
                waterMark.Visible = false;
            }
        }

    }
    private string FootText()
    {
        return "Professionshøjskolen University College Nordjylland   |   Aalborg   |   Hjørring   |  Thisted  |  72 69 00 00  |   ucn@ucn.dk";
    }
    protected void btnLogOut_Click(object sender, EventArgs e)
    {
        if (Request.Cookies["loginCookie"] != null)
        {
            HttpCookie cookie = Request.Cookies["loginCookie"];
            cookie.Expires = DateTime.Today.AddMinutes(-10);
            Response.Cookies.Add(cookie);
            Response.Redirect("~/Default.aspx");
        }
    }
}
